#ifndef DOCVIEWER_H
#define DOCVIEWER_H

#include <QWidget>
#include "treedoc.h"
#include "DbConnection.h"
#include "history.h"
#include "messenger.h"
#include "reminder.h"
class DocViewer : public QWidget
{
    Q_OBJECT
public:
    explicit DocViewer(DbConnection* DB, QWidget *Parent = 0);
    bool  initialization();
    QSplitter* splitter();
    void setCommonNumering(const bool&commonNumering);
    void setHistoryMaxSize(const int&maxSize);
    void setHighlighterOn(const bool&on);
    void setRefreshInterval(const int&interval);
    bool highlight() const;
    bool isWasChangedItem() const;
private:    
    QSplitter *m_splitter;
    TreeDoc m_tree;
    QVBoxLayout* m_layout;
    QWidget* m_view;
    QTreeWidgetItem *m_last;
    QAction* m_addMC;
    QAction* m_hlButton;
    History m_history;
    QString oldPosition;
    Messenger m_messenger;
    Reminder m_reminder;
    QTimer m_timer;
    QAction* m_refButton;
    QAction* m_saveButton;
    QAction* addMCButton();
    QAction* filterButton();
    QAction* highlighterButton();
    QAction* messengerButton();    
    void setWidget(QWidget* widget);
signals:
    void state_message(const QString&mess,int alignment, const QColor&color);
    void state_message(const QString&mess, int timeout);
    void toolBarChange(QList<QAction*>);
public slots:
    void setView(DocEntity* item);
private slots:
    void addMacAction();
    void addInnerMacAction();
    void onActionMenuChange(QAction* action);
    void onActionExecute();
    void onFilterChange();
    void onHighlighterOn();
    void onWasRefreshItem();
    void onTimeOut();
};

#endif // DOCVIEWER_H
